
from django.contrib import admin
from django.urls import path, re_path
from king_admin import views

urlpatterns = [
    # path('', views.index, name='table_index'),

]


def get_urls2():
    temp = []

    temp.append(path('add/', views.add))
    temp.append(re_path(r'(\d+)/delete/', views.delete))
    temp.append(re_path(r'(\d+)/change/', views.change))
    temp.append(path('', views.list_view))

    return temp


def get_urls():
    temp = []
    for model, admin_class_obj in admin.site._registry.items():
        # print('model', model)
        # class 'django.contrib.auth.models.Group'>
        # class 'django.contrib.auth.models.User'>
        # print("==>", model._meta.model_name)
        # print("==>", model._meta.app_label)
        model_name = model._meta.model_name
        app_label = model._meta.app_label
        temp.append(path('%s/%s/' % (app_label, model_name), (get_urls2(), None, None)))

    return temp

